<%@page import="ext.workflow.WorkFlowUtil"%>
<%@ page import="wt.org.WTUser,
                 java.util.*,
				 wt.method.RemoteMethodServer"%>


<%
	
	response.setCharacterEncoding("UTF-8");
	
	String userName = request.getParameter("username");
	boolean flag = (userName.equals("")|| userName.length()<0);//is null return true

	if(flag)
	{
		
		RemoteMethodServer rms = RemoteMethodServer.getDefault();
		ArrayList list = (ArrayList)rms.invoke("getAllUser",ext.workflow.WorkFlowUtil.class.getName(),null,null,null);

		if(list.size()>0)
		{
			String allList = new String("");
			String fullName = new String("");
			String getPrint = new String("<select id='groupMember' multiple='false' style='width:140px; height:200px'>");


			WTUser u = null;
			for(int i = 0;i<list.size();i++)
			{
				u = (WTUser)list.get(i);
				allList = u.getName();
				fullName = u.getFullName();
				getPrint = getPrint+"<option value='"+allList+"'>"+fullName+"("+allList+")</option>";
			}
			getPrint = getPrint+"</select>";
			out.clear();
			out.println(getPrint);
			

		}

	}

    
	if(userName.indexOf("*")!=-1)
	{
		String userNamePara = new String("");
		userNamePara = java.net.URLDecoder.decode(userName,"gb2312");

		String classname = ext.workflow.WorkFlowUtil.class.getName();
		Class args1[] = new Class[] {String.class};
		Object args2[] = new Object[] {userNamePara};
		ArrayList list = ((ArrayList)(RemoteMethodServer.getDefault().invoke("getUserLikeName",classname, null, args1, args2)));
		if(list.size()>0)
		{
			String allList = new String("");
			String fullName = new String("");
			String getPrint = new String("<select id='groupMember' multiple='false' style='width:140px; height:200px'>");


			WTUser u = null;
			for(int i = 0;i<list.size();i++)
			{
				u = (WTUser)list.get(i);
				allList = u.getName();
				fullName = u.getFullName();
				getPrint = getPrint+"<option value='"+allList+"'>"+fullName+"("+allList+")</option>";
			}
			getPrint = getPrint+"</select>";
			out.clear();
			out.println(getPrint);
			

		}
	}


	if(userName.indexOf("*")==-1 && flag==false)
	{
		String userNamePara = new String("");
		userNamePara = java.net.URLDecoder.decode(userName,"gb2312");

		String classname = ext.workflow.WorkFlowUtil.class.getName();
		Class args1[] = new Class[] {String.class};
		Object args2[] = new Object[] {userNamePara};
		ArrayList list = ((ArrayList)(RemoteMethodServer.getDefault().invoke("getUserByName",classname, null, args1, args2)));

		if(list.size()>0)
		{
			String allList = new String("");
			String fullName = new String("");
			String getPrint = new String("<select id='groupMember' multiple='false' style='width:140px; height:200px''>");


			WTUser u = null;
			for(int i = 0;i<list.size();i++)
			{
				u = (WTUser)list.get(i);
				allList = u.getName();
				fullName = u.getFullName();
				getPrint = getPrint+"<option value='"+allList+"'>"+fullName+"("+allList+")</option>";
			}
			getPrint = getPrint+"</select>";
			out.clear();
			out.println(getPrint);
			

		}
	}
	
	

	
     

%>